<?php

use think\facade\Route;
use think\facade\Env;

//Route::domain(Env::get('route.host_mgt', 'xlj2021admin.zoudingyong.com'), 'admin');
Route::domain(Env::get('route.host_mgt', 'mgt-ticket.zoudingyong.com'), 'admin');//正式

// vote模块
//Route::domain(Env::get('route.host_www', 'xljvote.zoudingyong.com'), function () {
Route::domain(Env::get('route.host_www', 'ticket.zoudingyong.com'), function () {
    Route::any('/', 'index/ticket/index');//首页
//    Route::rule('detail/:id', 'index/food/detail');
//    Route::any('/index_test', 'index/vote/index_test');//首页
//    Route::any('/test', 'index/vote/test');//首页
//    Route::any('/guests', 'index/vote/guests');//嘉宾
//    Route::any('ticket', 'index/vote/ticket');
//    Route::any('get_list', 'index/vote/get_list');
//    Route::any('top', 'index/vote/top');
//    Route::any('get_top', 'index/vote/get_top');
//    Route::any('search', 'index/vote/search');
//    Route::any('sign', 'index/vote/sign');
//    Route::any('sign_area', 'index/vote/sign_area');
//    Route::any('quan', 'index/vote/quan');
//    Route::any('mpcoupon', 'index/vote/mpcoupon');
//    Route::any('edit_sign', 'index/vote/edit_sign');
//    Route::any('test_edit_sign', 'index/vote/test_edit_sign');
//    Route::any('activity', 'index/vote/activity');
//    Route::any('about', 'index/vote/about');
//    Route::any('busy', 'index/vote/busy');
//    Route::any('area', 'index/vote/area');
//    Route::any('upload', 'index/vote/upload');
//    Route::any('cos_sts', 'index/vote/cos_sts');
//    Route::any('get_province', 'index/vote/get_province');
//    Route::any('get_city', 'index/vote/get_city');
//    Route::any('get_district', 'index/vote/get_district');
//    Route::any('lottery/lottery_show', 'index/lottery/lottery_show');
//    Route::any('lottery/lottery', 'index/lottery/lottery');
//    Route::any('lottery/myprizes', 'index/lottery/myprizes');
//    Route::any('lottery/my_reg_prizes', 'index/lottery/my_reg_prizes');
//    Route::any('lottery/get_list', 'index/lottery/get_list');
//    Route::post('lottery/delivery', 'index/lottery/delivery');
//    Route::rule('detail/:id', 'index/vote/detail');
});

// api子域名绑定到api模块
Route::domain('wx', function () {
    Route::miss('api/Miss/index');//路由错误返回
    /**
     * 首页
     */
    Route::any('v1/index/lists', 'api/Index/lists');//首页
    Route::any('v1/index/region', 'api/Index/region');//地区
    /**
     * Notify
     */
    Route::post('api/notify/weixin', 'api/Notify/weixin');//微信异步通知

});


/**
 * 模块路由及配置检测并加载
 */
foreach (scandir(env('app_path')) as $dir) {
    if ($dir[0] !== '.') {
        $filename = realpath(env('app_path') . "{$dir}/init.php");
        $filename && file_exists($filename) && include($filename);
    }
}

return [];
